using Commons.Models.Definitions;
using Commons.Models.Locks;
using System.Collections.Generic;
using System;

namespace Commons.Models.Settings
{
	[Serializable]
	public class LockSettings : ISettings
	{
		public Dictionary<int, Lock> Locks { get; protected set; }

		public LockSettings ()
		{
			Locks = new Dictionary<int, Lock>();
		}

		public Lock GetLock (int id)
		{
			return Locks[id];
		}

		public bool HasLock (int id)
		{
			return Locks.ContainsKey(id);
		}

		public void AddLock (Lock lockObject)
		{
			if (lockObject.Id != Lock.PublicId)
			{
				Locks.Add(lockObject.Id, lockObject);
			}
		}
	}
}
